package design_patterns;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

public class Intermediary implements MethodInterceptor {
    @Override
    public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
        before();
        Object feedback=methodProxy.invokeSuper(o,objects);
        after();
        return "eeee"+feedback;
    }
    public void before(){
        System.out.println("eeeee");
    }
    public void after(){
        System.out.println("吃饭吃饭");
    }
}
